package com.czxy.tanhua.vo;

import com.czxy.tanhua.entity.UserInfo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;

/**
 * @Author 爱吃豆的土豆、
 * @Date 2023/4/7 18:09
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class UserInfoVo implements Serializable {

    private Long id;

    /**
     * 昵称
     */

    private String nickname;

    /**
     * 用户头像
     */
    private String avatar;

    private String[] tags;

    /**
     * 性别，1-男，2-女，3-未知
     */

    private String gender;


    private Integer age;


    private Integer fateValue ;

    public static UserInfoVo init(UserInfo userInfo,Integer fateValue) {
        UserInfoVo userInfoVo = new UserInfoVo();
        BeanUtils.copyProperties(userInfo,userInfoVo);

        String[] split = userInfo.getTags().split(",");
        userInfoVo.tags = split;
        userInfoVo.setFateValue(fateValue);
        return userInfoVo;
    }
}
